package decorationPrice;

import decorationPrice.decorator.DiscountDecorator;
import decorationPrice.entity.ShoppingCart;
import decorationPrice.fruit.Apple;
import decorationPrice.fruit.Mango;
import decorationPrice.fruit.Strawberry;
import decorationPrice.strategy.FullReductionStrategy;
import decorationPrice.strategy.TotalDiscountStrategy;

public class CustomerOrder {
    public static void main(String[] args) {
        System.out.println("===== demo1 =====");
        demo1();
        System.out.println("===== demo2 =====");
        demo2();
        System.out.println("===== demo3 =====");
        demo3();
        System.out.println("===== demo4 =====");
        demo4();
    }

    private static void demo1() {
        ShoppingCart cart = new ShoppingCart();
        cart.addFruit(new Apple(2.0));
        cart.addFruit(new Strawberry(3.0));
        cart.printReceipt();
    }

    private static void demo2() {
        ShoppingCart cart = new ShoppingCart();
        cart.addFruit(new Apple(2.0));
        cart.addFruit(new Strawberry(3.0));
        cart.addFruit(new Mango(3.0));
        cart.printReceipt();
    }

    private static void demo3() {
        ShoppingCart cart = new ShoppingCart();
        cart.addFruit(new Apple(2.0));
        DiscountDecorator discountDecorator = new DiscountDecorator(new Strawberry(3.0), 0.8);
        cart.addFruit(discountDecorator);
        cart.addFruit(new Mango(3.0));
        cart.addPromotionStrategy(new TotalDiscountStrategy(1));
        cart.printReceipt();
    }

    private static void demo4() {
        ShoppingCart cart = new ShoppingCart();
        cart.addFruit(new Apple(2.0));
        DiscountDecorator discountDecorator = new DiscountDecorator(new Strawberry(3.0), 0.8);
        cart.addFruit(discountDecorator);
        cart.addFruit(new Mango(3.0));
        cart.addPromotionStrategy(new FullReductionStrategy(100,10));
        cart.printReceipt();
    }

}
